package com.springboot.helloworld.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version v1.0
 * @description: hello控制器
 * @author: xiaoliang.liu
 * @date: 2018/7/1 19:01
 */
@RestController
public class HelloController {

    /**
     * hello
     *
     * @return string
     */
    @GetMapping({"/", "/hello"})
    public String sayHello() {
        return "hello";
    }

    /**
     * path has arg
     *
     * @param id id
     * @return string
     */
    @GetMapping("/{id}")
    public String pathHasArg(@PathVariable("id") Integer id) {
        return id.toString();
    }
}
